package com.lyhengtongwl.zqsnews.utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class NewsBrowserShare {
    public static void openBrowser(Activity activity, String type, String url) {
        switch (type) {
            case "1"://打开qq浏览器
                openQQBrowser(activity, url);
                break;
            case "2"://uc浏览器
                openUCBrowser(activity, url);
                break;
            case "5"://搜狗浏览器
                openSoGouBrowser(activity, url);
                break;
            case "3"://百度浏览器
                openBaiDuBrowser(activity, url);
                break;
            case "4"://谷歌浏览器
                openGoogleBrowser(activity,url);
                break;
            case "6"://360浏览器
                break;
        }
    }

    private static void openQQBrowser(Activity activity, String url) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        Uri content_url = Uri.parse(url);
        intent.setData(content_url);
        intent.setClassName("com.tencent.mtt", "com.tencent.mtt.MainActivity");
        activity.startActivity(intent);

    }

    private static void openUCBrowser(Activity activity, String url) {
        Uri uri = Uri.parse(url);
        Intent intent = new Intent(Intent.ACTION_VIEW,uri);
        intent.setAction("android.intent.action.VIEW");
        intent.setClassName("com.UCMobile","com.uc.browser.InnerUCMobile");//打开UC浏览器
        activity.startActivity(intent);
    }

    private static void openGoogleBrowser(Activity activity, String url) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        Uri content_url = Uri.parse(url);
        intent.setData(content_url);
        intent.setClassName("com.android.chrome","com.google.android.apps.chrome.Main");
        activity.startActivity(intent);

    }

    private static void openSoGouBrowser(Activity activity, String url) {

    }

    private static void openBaiDuBrowser(Activity activity, String url) {

    }
}
